import { Channels } from '@/types/data'

// 消除   魔法字符串
const CHANNEL_KEY = 'itcast_geek_h5_channel'

export function getChannel () : Channels {
  return JSON.parse(localStorage.getItem(CHANNEL_KEY) || '[]')
}

// 保存token
export function setChannel (channels: Channels) {
  localStorage.setItem(CHANNEL_KEY, JSON.stringify(channels))
}

export function removeChannel () :void {
  localStorage.removeItem(CHANNEL_KEY)
}
